package com.baizhi.bzmall.admin.controller;

import com.baizhi.bzmall.admin.service.AdminService;
import com.baizhi.bzmall.common.vo.ResultEntity;
import com.baizhi.bzmall.entity.BzAdmin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collection;
import java.util.List;

@RestController
@RequestMapping("/admins")
public class AdminController {
    @Autowired
    private AdminService as;
    @GetMapping
    @PreAuthorize("hasAuthority('sys:schedule:list,sys:schedule:info')")
    public ResultEntity selectAll(){
        List<BzAdmin> bzAdmins = as.selectAll();
        return ResultEntity.ok(bzAdmins);
    }
}
